extends Node2D

# 道具通用模块

@onready var area = $Area2D
@onready var coll = $Area2D/CollisionShape2D
@export var price = 0		## 价格
@export var value = 0		## 效果数值

func _ready():
	area.connect("body_entered", bodyEntered)


# 玩家碰撞体进入药水拾取范围, 会触发拾取事件
func bodyEntered(body):
	# 如果添加成功, 就将道具隐藏
	# 并将碰撞体禁用, 放置二次拾取
	# 不销毁是因为后续玩家会使用, 销毁掉就调用不到use函数了
	if body.collection(self):
		coll.set_deferred("disabled", true)
		self.visible = false
